package com.ruoyi.project.deviceInfo.controller;

import java.util.List;

import com.ruoyi.project.device.msgXdkSsj.domain.MsgXdkSsj;
import com.ruoyi.project.device.msgXdkSsj.service.IMsgXdkSsjService;
import com.ruoyi.project.rgv.domain.MsgRgv;
import com.ruoyi.project.rgv.service.IMsgRgvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.project.deviceInfo.domain.MsgDdj;
import com.ruoyi.project.deviceInfo.service.IMsgDdjService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 设备监控Controller
 *
 * @author ruoyi
 * @date 2023-04-11
 */
@Controller
@RequestMapping("/deviceInfo")
public class MsgDdjController extends BaseController
{
    private String prefix = "deviceInfo";

    @Autowired
    private IMsgDdjService msgDdjService;

    @Autowired
    private IMsgXdkSsjService msgXdkSsjService;
    @Autowired
    private IMsgRgvService msgRgvService;

    @GetMapping()
    public String deviceInfo()
    {
        return prefix + "/deviceInfo";
    }

    /**
     * 查询设备监控列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(MsgDdj msgDdj)
    {
        startPage();
        List<MsgDdj> list = msgDdjService.selectMsgDdjList(msgDdj);
        return getDataTable(list);
    }



    @RequestMapping("/list1")
    @ResponseBody
    public TableDataInfo list1(MsgDdj msgDdj)
    {
//        startPage();
        List<MsgDdj> list = msgDdjService.selectMsgDdjList(msgDdj);
        return getDataTable(list);
    }



    @RequestMapping("/ddj/list1")
    @ResponseBody
    public TableDataInfo ddjlist1()
    {
//        startPage();
        List<MsgDdj> list = msgDdjService.selectMsgDdjlist1();
        return getDataTable(list);
    }



    @RequestMapping("/ddj/list2")
    @ResponseBody
    public TableDataInfo ddjlist2()
    {
//        startPage();
        List<MsgDdj> list = msgDdjService.selectMsgDdjlist2();
        return getDataTable(list);
    }







    @RequestMapping("/list2")
    @ResponseBody
    public TableDataInfo list2(MsgRgv msgRgv)
    {
//        startPage();
        List<MsgRgv> list = msgRgvService.selectMsgRgvList(msgRgv);
        return getDataTable(list);
    }





    @RequestMapping("/list3")
    @ResponseBody
    public TableDataInfo list3(MsgXdkSsj msgXdkSsj)
    {
//        startPage();
        List<MsgXdkSsj> list = msgXdkSsjService.selectMsgXdkSsjList(msgXdkSsj);
        return getDataTable(list);
    }





    /**
     * 导出设备监控列表
     */
    @Log(title = "设备监控", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(MsgDdj msgDdj)
    {
        List<MsgDdj> list = msgDdjService.selectMsgDdjList(msgDdj);
        ExcelUtil<MsgDdj> util = new ExcelUtil<MsgDdj>(MsgDdj.class);
        return util.exportExcel(list, "设备监控数据");
    }

    /**
     * 新增设备监控
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存设备监控
     */
    @Log(title = "设备监控", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(MsgDdj msgDdj)
    {
        return toAjax(msgDdjService.insertMsgDdj(msgDdj));
    }

    /**
     * 修改设备监控
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        MsgDdj msgDdj = msgDdjService.selectMsgDdjById(id);
        mmap.put("msgDdj", msgDdj);
        return prefix + "/edit";
    }

    /**
     * 修改保存设备监控
     */
    @Log(title = "设备监控", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(MsgDdj msgDdj)
    {
        return toAjax(msgDdjService.updateMsgDdj(msgDdj));
    }

    /**
     * 删除设备监控
     */
    @Log(title = "设备监控", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(msgDdjService.deleteMsgDdjByIds(ids));
    }
}
